﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Runtime.InteropServices;

namespace AutoBuyWinform
{
    public partial class YjPage : Form
    {
        [DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern bool InternetSetCookie(string url, string name, string data);

        public YjPage()
        {
            InitializeComponent();
        }

        public void resetUrl(string url)
        {
            yjBrowser.Url = new Uri(url);
        }

        public void resetTitle(string url)
        {
            this.Text = url;
        }


        public void addCookie(Cookie cookie)
        {
            InternetSetCookie(
                    "https://" + cookie.Domain.ToString(),
                    cookie.Name.ToString(),
                    cookie.Value.ToString() + ";expires=Sun,22-Feb-2099 00:00:00 GMT");
        }

        private void yjBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

        }


    }
}
